package com.sh.data.engine.domain.datadev.offline.runner;

import com.google.common.collect.Lists;
import com.sh.data.engine.domain.datadev.offline.model.enums.OfflineDevJobStatusEnum;
import com.sh.data.engine.repository.dao.datadev.entity.DatadevJobEntity;
import com.sh.data.engine.repository.dao.datadev.entity.DatadevMenuNodeEntity;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;

/**
 * @Author: zigui.zdf @Date: 2022/3/1 12:02:42 @Description:
 */
public class OfflineDevVnodeJobRunner extends OfflineDevBaseJobRunner {

    public OfflineDevVnodeJobRunner(
        DatadevJobEntity jobEntity,
        DatadevMenuNodeEntity menuNodeEntity,
        Map<Long, Integer> parentNodeIdAndLineStatusMap,
        List<Long> childNodeIdList,
        Map<Long, OfflineDevBaseJobRunner> allJobNodeMap,
        ExecutorService executorService) {
        super(
            jobEntity,
            menuNodeEntity,
            parentNodeIdAndLineStatusMap,
            childNodeIdList,
            allJobNodeMap,
            executorService);
    }

    @Override
    public void cancel() {
    }

    @Override
    public int runJob() {
        String log = "开启任务,资源请求中";
        log = formatLogWithTime(log);

        List<String> logs = Lists.newArrayList(log);

        this.writeLog(logs);

        return OfflineDevJobStatusEnum.SUCCESS.getCode();
    }
}
